<template>
	<view>
		<view>
			<view class='top'>
				<u-row align='top'>
					<u-col :span='6'>
						<view>
							<view style='color:#f3f3f3'>钱包余额(元)</view>
							<view style='font-size:32px;padding-top:5px;color:#fff'>
								<text style='font-size:20px'>￥</text> {{amount}}
							</view>
						</view>
					</u-col>
					<u-col :span='6'>
					</u-col>
				</u-row>
				<view style='padding-top:20px'>
					<u-row>
						<u-col :span='8'>
						</u-col>
						<u-col :span='4'>
							<view>
								<u-button @click='toUrl("/pages/mine/withdrawal")' type='success' text='提现'
									shape='circle' size='large' :plain='true'></u-button>
							</view>
						</u-col>
					</u-row>
				</view>
			</view>
			<view style='padding:20px 10px;color：#fff;font-weight: bold;'>
				<u-row>
					<u-col span='6'>
						<view class='btn-left'>
							<u-row @click='toUrl("/pages/mine/balance-logs")'>
								<u-col span='4'>
									<u-avatar
										src="https://picture.jmgc.vip/02726e69-2576-462f-8c12-bce97868a097.png"></u-avatar>
								</u-col>
								<u-col span='6'>
									<view style='color:#fff'>账单明细</view>
								</u-col>
								<u-col span='2'>
									<u-icon name="arrow-right" color='#fff'></u-icon>
								</u-col>
							</u-row>
						</view>
					</u-col>
					<u-col span='6'>
						<view class='btn-right'>
							<u-row @click='toUrl("/pages/mine/withdrawal-logs")'>
								<u-col span='4'>
									<u-avatar
										src="https://picture.jmgc.vip/93e056ac-b715-438e-9b08-9a50602d35d2.png"></u-avatar>
								</u-col>
								<u-col span='6'>
									<view style='color:#fff'>提现记录</view>
								</u-col>
								<u-col span='2'>
									<u-icon name="arrow-right" color='#fff'></u-icon>
								</u-col>
							</u-row>
						</view>
					</u-col>
				</u-row>
			</view>
			<u-cell-group>
				<u-cell title="成为推手" :isLink='true' @click='toUrl("/pages/mine/to-be-staff")'></u-cell>
			</u-cell-group>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				amount: 0,
				bankCard: '',
				activityRecordCount: 0
			}
		},
		onLoad() {

		},
		onShow() {
			let token = uni.getStorageSync('api_token')
			if (token != '') {
				this.request.get(`api/balances`).then((res) => {
					console.log('balance', res)
					if (res.data && res.data.amount) {
						this.amount = res.data.amount
					}
				})
			}else{
				uni.switchTab({
					url: '/pages/index/index'
				})
			}
			let carts = uni.getStorageSync('carts')
			if (carts != '') {
				this.carts = carts
				uni.setTabBarBadge({
					index: 2,
					text: `${carts.length}`
				})
			} else {
				uni.removeTabBarBadge({
					index: 2
				})
			}

		},
		methods: {
			toUrl(page) {
				uni.navigateTo({
					url: page
				})
			}
		}
	}
</script>

<style>
	.btn-left {
		background-color: #239965;
		border-radius: 15px;
		margin-right: 5px;
		padding: 10px;
		border: solid #f3f3f3 1px;
	}

	.btn-right {
		background-color: #239965;
		border-radius: 15px;
		margin-left: 5px;
		padding: 10px;
		border: solid #f3f3f3 1px;
	}

	.content {
		background-color: #f3f3f3;
		color: #909399;
		min-height: 100vh;
		overflow: auto;
	}

	.top {
		background: linear-gradient(to bottom, #239965, #71d5a1);
		padding: 20px 15px;
		// margin: 10px 10px 0px 10px;
		border-radius: 0px 0px 10px 10px;
		color: #fff;
	}
</style>